#### 10/26/2018
#### Replication Code:
#### Goldman, Seth and Daniel J. Hopkins
#### "Past Place, Present Prejudice"
#### 
#### R code enabling analyses of
#### 2008 National Annenberg Election Studies
#### / 2012 Institute for the Study of Citizens and Politics 
#### survey

#### load libraries
library(xtable)
library(arm)
library(lme4)

source("/context-dataloadtransform-10262018.R")

#### identify southern high schools
dta3$SOUTHHS <- NA
dta3$SOUTHHS[dta3$STFIPSRE %in% c(1,5,12,13,22,28,37,45,47,48,51)] <- 1
dta3$SOUTHHS[! dta3$STFIPSRE %in% c(1,5,12,13,22,28,37,45,47,48,51) & ! dta3$STFIPSRE %in% c(NA)] <- 0

vars <- c("PID7","EDYEARS","INCOME","AGE","FEMALE","MARRIED7","RETIRED7","DISABLED7","COPCNHBL10","COPCIMM10","COPCBCH10","COUNEMP10","COPCNHBLAGE16","COPCIMMAGE16","COPCBCHAGE16","COUNEMPAGE16","STAY")

rmat <- matrix(NA,length(vars),4)
for(i in 1:length(vars)){

	txt <- paste("hold <- dta3$",vars[i],"[! dta3$prejudice_7 %in% c(NA)]",sep="")
	eval(parse(text=txt))

	rmat[i,1] <- min(hold,na.rm=T)
	rmat[i,2] <- max(hold,na.rm=T)
	rmat[i,3] <- mean(hold,na.rm=T)
	rmat[i,4] <- sd(hold,na.rm=T)
}
rownames(rmat) <- vars
colnames(rmat) <- c("Min","Max","Mean","SD")
xtable(rmat,digits=c(0,2,2,2,2))

dta4 <- dta3[! dta3$BLACK==1 & ! dta3$HISP==1,]

##### Contemporary contexts, no post-treatment covariates
lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)


lout10a <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

#######

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout20a <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

#######################
##### with hs in south
#######################
lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO+SOUTHHS,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout20dd <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

### both context w/o covariates

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

lout30a <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

texreg(list(lout10a,lout20a,lout30a),stars=0.05)

M <- 10000
x1 <- rnorm(M,mean=8.68471,sd=3.10387 )
sum(x1 < 0)/length(x1)*2

M <- 10000
x1 <- rnorm(M,mean= 12.81338,sd=3.59716)
sum(x1 < 0)/length(x1)*2

M <- 10000
x1 <- rnorm(M,mean= 12.96456 ,sd= 4.33350 )
sum(x1 < 0)/length(x1)*2

M <- 10000
x2 <- rnorm(M,mean= 1.55026  ,sd=  4.06519 )
sum(x2 < 0)/length(x2)*2

x3 <- x2 - x1
2*(1-sum(x3 < 0)/length(x3))

##########
###########################
#### hs contexts with covariates
##########

##### BASIC MODEL with individual level covariates
lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout1 <- lout <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

################

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16++COUNEMPAGE16+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

lout2 <- lout <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

###########
#### MOVERS
###########

#########
######### movers and stayers
dta3m <- dta3[dta3$STAY==0,]

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf8 <- model.frame(lout8)

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout1m <- lmer(prejudice ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

######

dta3m <- dta3[dta3$STAY==1,]

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf8 <- model.frame(lout8)

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout1s <- lmer(prejudice ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

########

dta3m <- dta3[dta3$STAY==0,]

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf8 <- model.frame(lout8)

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout1mi <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

dta3m <- dta3[dta3$STAY==1,]

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3m)
mf8 <- model.frame(lout8)

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout2mi <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

texreg(list(lout1m,lout1s,lout1mi,lout2mi),stars=0.05,digits=3)

######
#####

dta3m <- dta3[dta3$STAY==0,]

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16++COUNEMPAGE16+MNO,data=dta3m)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout3mi <- lout <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

#####

dta3m <- dta3[dta3$STAY==1,]

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+MNO,data=dta3m)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16++COUNEMPAGE16+MNO,data=dta3m)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout4mi <- lout <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

texreg(list(lout1m,lout1s,lout1mi,lout2mi,lout3mi,lout4mi),stars=0.05,digits=2,custom.model.names=c("Different County","Same County","Different County","Same County","Different County","Same County"))

x1 <- rnorm(10000,mean= 8.14892,sd=    4.30086 )
x2 <- rnorm(10000,mean= 24.74290,sd=    6.66034 )

1-sum(x1 > x2)/length(x1)

##########
###### AGE
##########
###### break out by age

lout3 <- lm(prejudice_3 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout30a <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+(1|MNO),data=dtaj)

texreg(list(lout20a,lout30a),stars=0.05)

lout3a <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj[dtaj$AGE < 50,])

lout3b <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj[dtaj$AGE >= 50,])

lout3c <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16*AGE+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

texreg(list(lout3a,lout3b,lout3c))

#############
##### DEMPCT democratic percentage
#############

lout3 <- lm(prejudice_3 ~ AGE+FEMALE++COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO+CODEMPCT10,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

#lout1d <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+(1|MNO),data=dtaj)

#texreg(lout1d)

cor(dtaj$CODEMPCT10,dtaj$COPCNHBL10)
#[1] 0.4228154

lout3 <- lm(prejudice_3 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16++COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout2d <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+(1|MNO),data=dtaj)

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10++MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout3d <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+CODEMPCT10+(1|MNO),data=dtaj)

texreg(list(lout1d,lout2d,lout3d),stars=0.05)

####################
#### UNEMPLOYMENT
#### contemporary unemployment interaction

lout3d <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16*COUNEMP10+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

####################
##### ESTIMATE BASIC MODEL WITH INTERACTIONS
#### WITH PRIOR UNEMPLOYMENT

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE++COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout3e <- lout <- lmer(prejudice ~ AGE+FEMALE++COPCNHBLAGE16*COUNEMPAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

dtajle <- dtaj[dtaj$COUNEMPAGE16 < median(dtaj$COUNEMPAGE16,na.rm=T),]
dtajhe <- dtaj[dtaj$COUNEMPAGE16 >= median(dtaj$COUNEMPAGE16,na.rm=T),]

lout3le <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajle)

lout3he <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajhe)

texreg(list(lout3e,lout3le,lout3he),stars=0.05,custom.model.names=c("Interaction","Low Unemp.","High Unemp."))

##### ESTIMATE BASIC MODEL WITH INTERACTIONS
#### WITH CONTEMPORARY UNEMPLOYMENT

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+COPCNHBL10+COPCIMM10+COPCBCH10+COUNEMP10+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout3e <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16*COUNEMP10+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

dtajle <- dtaj[dtaj$COUNEMP10 < median(dtaj$COUNEMP10,na.rm=T),]
dtajhe <- dtaj[dtaj$COUNEMP10 >= median(dtaj$COUNEMP10,na.rm=T),]

lout3le <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajle)

lout3he <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajhe)

texreg(list(lout3e,lout3le,lout3he),stars=0.05,custom.model.names=c("Interaction","Low Unemp.","High Unemp."))

lout3ed <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16*COPCBCHAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

dtajled <- dtaj[dtaj$COPCBCHAGE16 < median(dtaj$COPCBCHAGE16,na.rm=T),]
dtajhed <- dtaj[dtaj$COPCBCHAGE16 >= median(dtaj$COPCBCHAGE16,na.rm=T),]

lout3led <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajled)

lout3hed <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtajhed)

texreg(list(lout3ed,lout3led,lout3hed),stars=0.05,custom.model.names=c("Interaction","Low Educ.","High Educ"))

texreg(list(lout3e,lout3le,lout3he,lout3ed,lout3led,lout3hed),stars=0.05,custom.model.names=c("Interaction","Low Unemp.","High Unemp.","Interaction","Low Educ.","High Educ"))

##############
##### CONTACT
##############

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+MNO,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout5c3 <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+(1|MNO),data=dtaj)

lout5c1 <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+(1|MNO),data=dtaj[dtaj$CTBLKHSL==0,])

lout5c2 <- lout <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+CTBLKHSL+(1|MNO),data=dtaj[dtaj$CTBLKHSL > 0,])

texreg(list(lout5c3,lout5c1,lout5c2),digits=2,stars=0.05,custom.model.names=c("Model w/ Contact","No Contact","Some Contact"))

######
### BROADER GEOGRAPHIC AREA
######

lout3 <- lm(prejudice_3 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+MNO+SOUTH,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

library(lme4)
library(arm)

lout1a <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

lout1c <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAREAAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

lout1d <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+SOUTH+COPCNHBLAREAAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

lout1e <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16+COPCNHBLAREAAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

lout1f <- lmer(prejudice ~ PID7+EDYEARS+INCOME+AGE+FEMALE+MARRIED7+RETIRED7+DISABLED7+COPCNHBLAGE16*COPCNHBLAREAAGE16+COPCIMMAGE16+COPCBCHAGE16+COUNEMPAGE16+(1|MNO),data=dtaj)

texreg(list(lout1a,lout1c,lout1e,lout1f),stars=c(0.05))

x1 <- rnorm(10000,mean=15.47,sd=4.21)
2*(1-sum(x1 > 0)/length(x1))

###########

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)
#dtaj <- rbind(mf4,mf5,mf6,mf7,mf8)

lout1a <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+(1|MNO),data=dtaj)

lout1b <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16++(1|MNO),data=dtaj)

lout1c <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+(1|MNO),data=dtaj)

lout1d <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16++COPCNHBLAGE16*COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+(1|MNO),data=dtaj)

#lout1e <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH+(1|MNO),data=dtaj)

#lout1f <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTH+(1|MNO),data=dtaj)

texreg(list(lout1a,lout1b,lout1c,lout1d),stars=c(0.05))


#### GREW UP IN SOUTH

lout3 <- lm(prejudice_3 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf3 <- model.frame(lout3)

lout4 <- lm(prejudice_4 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf4 <- model.frame(lout4)

lout5 <- lm(prejudice_5 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf5 <- model.frame(lout5)

lout6 <- lm(prejudice_6 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf6 <- model.frame(lout6)

lout7 <- lm(prejudice_7 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf7 <- model.frame(lout7)

lout8 <- lm(prejudice_8 ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAREAAGE16+COUNEMPAGE16+CODEMVOTEPCTAGE16+MNO+SOUTHHS,data=dta3)
mf8 <- model.frame(lout8)

colnames(mf3)[1] <- colnames(mf4)[1] <- colnames(mf5)[1] <- colnames(mf6)[1] <- colnames(mf7)[1] <- colnames(mf8)[1] <- "prejudice"

identical(colnames(mf3),colnames(mf4))
identical(colnames(mf5),colnames(mf4))
identical(colnames(mf5),colnames(mf6))
identical(colnames(mf7),colnames(mf6))
identical(colnames(mf7),colnames(mf8))

mf3$wave <- 3
mf4$wave <- 4
mf5$wave <- 5
mf6$wave <- 6
mf7$wave <- 7
mf8$wave <- 8

dtaj <- rbind(mf3,mf4,mf5,mf6,mf7,mf8)

lout1a <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAGE16+COUNEMPAGE16+(1|MNO),data=dtaj[dtaj$SOUTHHS==1,])

lout1b <- lmer(prejudice ~ AGE+FEMALE+COPCNHBLAGE16+COPCIMMAGE16+COPCBCHAGE16+COPCNHBLAGE16+COUNEMPAGE16+(1|MNO),data=dtaj[dtaj$SOUTHHS==0,])

texreg(list(lout1a,lout1b),stars=c(0.05))


x1 <- rnorm(100000,mean=12.49,sd=10.12)
x2 <- rnorm(100000,mean=6.94,sd=5.36)
1-sum(x1 > x2)/length(x1)


